<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:h="http://java.sun.com/jsf/html">

<h:head>
	<title>openMEDIS</title>
</h:head>

<ui:composition template="/WEB-INF/templates/default.xhtml">
	<ui:define name="content">
<style type="text/css">
.inputLabel{
	font-size:1.5em;
	font-weight: bold ;
	color: #336600 !important;
}
</style>
		<p:growl id="assetMessages" showDetail="true"></p:growl>
		<h:form id="mainForm">
		
			<p:panel header="Classifier">
				<h:panelGrid id="main" columns="4">
					<h:outputLabel value="Equipment category: *" styleClass="inputLabel"/>
					<p:selectOneMenu id="category"
						value="#{testBean.dev.assetcategory1}">
						<f:selectItems value="#{testBean.categoryList}" />
					</p:selectOneMenu>
					<h:outputText />
					<h:outputText />


					<h:outputLabel value="Equipment name: *"  styleClass="inputLabel"/>
					<p:inputText id="name" readonly="true"
						value="#{assetsController.viewBean.currentAsset.umdns.genericAssetName}">
					</p:inputText>
					<p:commandButton id="basic" value="Search"
						oncomplete="dlgFindUmdns.show()" update="childForm" />
					<p:message for="name"></p:message>

					<h:outputLabel value="UMDNS code: *"  styleClass="inputLabel"/>
					<p:inputText id="code"
						value="#{assetsController.viewBean.currentAsset.umdns.genericAssetCode}"
						required="true" requiredMessage="Code is requied" />
					<h:outputText />
					<p:message for="code"></p:message>
				</h:panelGrid>
			</p:panel>

			<p:panel header="Asset">
				<h:panelGrid columns="4">
					<h:outputLabel value="Full name"  styleClass="inputLabel"/>
					<p:inputText id="fullName"
						value="#{assetsController.viewBean.currentAsset.fullName}"
						required="true" requiredMessage="FullName is required"></p:inputText>
					<h:outputText />
					<p:message for="fullName"></p:message>
					
					<h:outputLabel value="Manufacturer"  styleClass="inputLabel"/>
					<p:inputText id="manufacturer"
						required="true" requiredMessage="Manufacturer is required"></p:inputText>
					<h:outputText />
					<p:message for="manufacturer"></p:message>

					<h:outputLabel value="Model" styleClass="inputLabel"/>
					<p:inputText id="model"
						required="true" requiredMessage="Model is required"></p:inputText>
					<h:outputText />
					<p:message for="model"></p:message>

					<h:outputLabel value="Date of Manufacturing" styleClass="inputLabel"/>
					<p:calendar id="dateOfManufacturing" required="true" requiredMessage="Date is required"></p:calendar>
					<h:outputText />
					<p:message for="dateOfManufacturing"></p:message>

					<h:outputLabel value="Masked Date" styleClass="inputLabel"/>
					<p:inputMask mask="99/99/9999" id="maskedDate" required="true" requiredMessage="Field is required">
					</p:inputMask> 
					<h:outputText />
					<p:message for="maskedDate"></p:message>
					
					<h:outputLabel value="Serial Number" styleClass="inputLabel"/>
					<p:inputText id="serialNumber" required="true" requiredMessage="Date is required"></p:inputText>
					<h:outputText />
					<p:message for="serialNumber"></p:message>
					
					<h:outputLabel value="Inventory Number" styleClass="inputLabel"/>
					<p:inputText id="inventoryNumber" required="true" requiredMessage="Date is required"></p:inputText>
					<h:outputText />
					<p:message for="inventoryNumber"></p:message>
				</h:panelGrid>
			</p:panel>
			
			<p:panel header="Location">...</p:panel>
			<p:panel header="Other">...</p:panel>
			<p:commandButton action="#{assetsController.saveCreatedAsset}"
				ajax="false" value="Save" update="assetMessages"></p:commandButton>
		</h:form>
	</ui:define>

	<ui:define name="outOfLayout">
		<!-- Dialog is lazy loaded because of dynamic="true" -->
		<p:dialog widgetVar="dlgFindUmdns" header="Find UMDNS" modal="true"
			dynamic="true" resizable="false" position="top">
			<h:form id="formFindUmdns">
				<h:panelGrid>
					<h:panelGrid columns="2" width="100%" style="text-align: right;">
						<p:inputText id="search"
							value="#{umdnsController.viewBean.searchString}"
							style="margin-right: 2px; height: 14px; width: 110%"></p:inputText>
						<p:commandButton image="ui-icon ui-icon-search"
							actionListener="#{umdnsController.findUmdns}"
							update="formFindUmdns"
							style="height: 25px; margin-top: 1px; width: 25px;"></p:commandButton>
					</h:panelGrid>

					<p:dataTable value="#{umdnsController.umdnsTable.umdnsList}"
						var="item" emptyMessage="No UMDNS codes were found"
						paginator="true" paginatorPosition="bottom"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rows="20" rowsPerPageTemplate="20, 50, 100, 200, 500"
						pageLinks="5" scrollable="true" scrollHeight="400"
						selection="#{umdnsController.umdnsTable.selectedUmdns}"
						selectionMode="single" rowKey="#{item.genericAssetId}">
						<p:column headerText="Code">
							<h:outputText value="#{item.genericAssetCode}" />
						</p:column>
						<p:column headerText="Name">
							<h:outputText value="#{item.genericAssetNameHighlighted}" />
						</p:column>
						<p:column headerText="Picture">
							<h:outputText value="#{item.genericPicture}" />
						</p:column>
					</p:dataTable>
					<h:panelGroup style="text-align: right; display: block;">
						<p:commandButton value="Cancel" type="button"
							onclick="dlgFindUmdns.hide(); "></p:commandButton>
						<p:commandButton value="Ok"
							actionListener="#{assetsController.setUmdns}"
							oncomplete="dlgFindUmdns.hide();"
							update="mainForm:code, mainForm:name"></p:commandButton>
					</h:panelGroup>
				</h:panelGrid>
			</h:form>
		</p:dialog>
	</ui:define>
</ui:composition>
</html>